package com.ruoyi.web.controller.app.borehole;

import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.web.domain.query.AddMeetQuery;
import com.ruoyi.web.domain.query.MeetPageQuery;
import com.ruoyi.web.domain.vo.MeetPageVO;
import com.ruoyi.web.service.BhMeetsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Tag(name = "班前班后会-App端")
@RestController
@RequestMapping("/app/meet")
public class AppMeetController {
    @Autowired
    private BhMeetsService bhMeetsService;

    @Operation(summary = "新增班前班后会")
    @RepeatSubmit
    @PostMapping("/addMeet")
    public R<Void> addMeet(@RequestBody AddMeetQuery addMeetQuery) {
        return bhMeetsService.addMeet(addMeetQuery);
    }

    @Operation(summary = "班前班后会列表页 - 分页查询")
    @GetMapping("/getMeetPage")
    public TableDataInfo<MeetPageVO> getMeetPage(@Validated(QueryGroup.class) MeetPageQuery meetPageQuery, PageQuery pageQuery) {
        return bhMeetsService.getMeetPage(meetPageQuery, pageQuery);
    }

    @Operation(summary = "班前班后会详情")
    @GetMapping("/getMeetDetail")
    public R<MeetPageVO> getMeetDetail(@RequestParam("id") Integer id) {
        return bhMeetsService.getMeetDetail(id);
    }

    @Operation(summary = "编辑班前班后会")
    @RepeatSubmit
    @PostMapping("/modMeet")
    public R<Void> modMeet(@RequestBody AddMeetQuery addMeetQuery) {
        return bhMeetsService.modMeet(addMeetQuery);
    }
}
